home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / falcon / programm.ing / asm56.zoo / rvb2.a56 < prev    next >
Text File  |  1992-11-14  |  20KB  |  416 lines

  1. ;   filename: RVB2.ASM
  2. ;
  3. ;
  4. ;       This code is an optimized version of the reverberation algorithm
  5. ;       found in file RVB1.ASM.  This program makes use of the parallel
  6. ;       move functionality of the 56001.  While this tends to make the
  7. ;       code less readible, it does increase its speed.  This version
  8. ;       is intended to run on the DSP56000ADSx (Application Development
  9. ;       System)board rev #2, with memory expansion.  The memory should 
  10. ;       be configured figured for 8K p-memory, 16K x-memory, 8K y-memory.
  11. ;       
  12. ;       Further gains in algorithm speed could be realized on boards not
  13. ;       constrained by the ADS memory limitations.  For example, due to
  14. ;       the need for 4 comb filters' worth of storage (each using about 
  15. ;       3500 samples - which takes 4096 samples each after using the DSM
  16. ;       statement) to fit into the 16K available for the x memory, we
  17. ;       must start at address $0000.  Thus, we are forced to use all the
  18. ;       56000's internal memory for sample storage.  Without being forced
  19. ;       to start sample storage at $0000, the 56000's internal memory could
  20. ;       be used for coefficient storage, allowing better use of parallel 
  21. ;       x and y moves.
  22. ;
  23. ;                               Motorola DSP Group
  24. ;                               Austin, Texas
  25. ;
  26. ;**************************************************************************
  27. ; This program was originally available on the Motorola DSP bulletin board
  28. ; and is provided under a DISCLAIMER OF WARRANTY available from Motorola
  29. ; DSP Operation, 6501 William Cannon Dr. W Austin, Texas  78735-8598.
  30. ;**************************************************************************
  31. ;--------------------------------------------------------------------------
  32. ;       This reverberation program is a variation of the reverberation
  33. ;       system and structures as described by James Moorer's article entitled
  34. ;        'About this Reverberation Business', Computer Music Journal,
  35. ;        3(2):13-28, 1979
  36. ;
  37. ;       Structure is:
  38. ;                                                       .----------.
  39. ;                            .------------.   .-----.   | All Pass |
  40. ;                         +->| Comb Filter|-->| SUM |-->| Reverb   |
  41. ;   Note: All Comb        |  |   #1       |   '-----'   |          |
  42. ;         Filters         |  '------------'   ^  ^  ^   '----------'
  43. ;         Have a 1st      |  .------------.   |  |  |        |
  44. ;         Order IIR       |->| Comb Filter|---+  |  |    .---V---.
  45. ;         LPF in their    |  |   #2       |      |  |    | align |
  46. ;         feedback        |  '------------'      |  |    | delay |
  47. ;         loop            |  .------------.      |  |    '---|---'
  48. ;                         |->| Comb Filter|------+  |        |
  49. ;                         |  |   #3       |         |      -----   reverb         
  50. ;                         |  '------------'         |       \./     gain
  51. ;                         |  .------------.         |        |
  52. ;                         |->| Comb Filter|---------+        |
  53. ;                         |  |   #4       |                  |
  54. ;                         |  '------------'                  |
  55. ;                         |                                  V
  56. ;         .------------.  |        FIR gain          .----------.
  57. ;         |   Early    |  |         |\               |          |
  58. ;input -->| Reflection |--+---------|  >------------>|  summer  |--- output
  59. ;      |  |    FIR     |            |/               |          |
  60. ;      |  '------------'                             '----------'      
  61. ;      |                                                  ^
  62. ;      |                                                  |
  63. ;      |                             dry gain             |
  64. ;      |                              |\                  |
  65. ;      +------------------------------|  >----------------+
  66. ;                                     |/
  67. ;       
  68. ;.............................................................................
  69. ;  COMB FILTER SUB STRUCTURE:
  70. ;                                .-------.
  71. ;      comb i        .-----.     | long  |                    comb i
  72. ;      input  ------>| sum |---->| delay |-------+--------->  output
  73. ;                    '-----'     '-------'       |
  74. ;                       ^                        |
  75. ;                       |                        V
  76. ;                       |       /|            .-----.
  77. ;                       +-----<   ------------| sum |<--------+
  78. ;                               \|            '-----'         |
  79. ;                            fdbck i             |           / \  lpf i gain
  80. ;                             gain               V         /_____\
  81. ;                             gain           .----------.     |
  82. ;                                            | 1 sample |     |
  83. ;                                            |  delay   |-----+
  84. ;                                            '----------'
  85. ;.............................................................................
  86. ;   UNIT (ALL PASS) REVERBERATOR STRUCTURE:
  87. ;   based on Schroeder as outlined in Griesinger: 'Practical Processors and
  88. ;   Programs for Digital Reverberation', Audio in Digital Times, 7th AES
  89. ;   conference, Toronto, Ontario, 1989
  90. ;   (the structure outlined in Moorer is a variation of this)
  91. ;
  92. ;                               -g
  93. ;                            |\
  94. ;                +---------->|  >--------------------------+
  95. ;                |           |/                            |
  96. ;                |                                         |
  97. ;                |                                         V
  98. ;    unit        |    .-----.   .--------.       |\     .-----.       unit
  99. ;    input ------+--->| sum |-->| delay  |--+--->|  >-->| sum |-----> output
  100. ;                     '-----'   '--------'  |    |/     '-----'
  101. ;                        ^                  |   1-g**2
  102. ;                        |     g            | 
  103. ;                        |       /|         |
  104. ;                        +-----<  |---------+
  105. ;                                \|
  106. ;
  107. ;...........................................................................
  108. ;
  109. ;       one multi-tap fir structure - to handle early reflections
  110. ;
  111. ;       followed by 4 parallel comb (iir) filters (each comb having 
  112. ;       a first order LPF in its feedback loop
  113. ;       
  114. ;       followed by an 'allpass' reverberator whose output is then 
  115. ;       delayed so that its first output follows after the last "early
  116. ;       reflection" output 
  117. ;
  118. ;__________________________________________________________________________
  119. ;
  120.         opt cex
  121.         page 132
  122.  
  123. ;--------------------------------------------------constant declarations
  124. adc     equ     $ffef           ; ADC address
  125. dac     equ     $ffef           ; DAC address
  126.  
  127. ntap    equ     7               ; number of taps 
  128. ntapp10 equ     ntap+10         ; # taps + 10 for other variables
  129. tapmod  equ     ntapp10-1       ; number of taps minus 1         
  130. dlymx   equ     4000            ; length of delay line in samples
  131.  
  132. cmbdly1 equ     2205            ; COMB FILTER CONSTANTS
  133. cmbdly2 equ     2690            ; delay values (in samples)
  134. cmbdly3 equ     3175
  135. cmbdly4 equ     3440
  136.  
  137. cmbmod1 equ       3490          ; modulo for comb #1 delay line   THESE ARE
  138. cmbmod2 equ       3490          ;   "         "   #2   "   "      ALSO THE 
  139. cmbmod3 equ       3490          ;   "         "   #3  "    "     MAX DELAYS
  140. cmbmod4 equ       3490          ;   "         "   #4  "    "      ALLOWED FOR
  141.                                 ;                                 CHOSEN DSM
  142.                                 ;                                 VALUE
  143.  
  144. untrvbdly       equ     265                 ; delay     UNIT (or ALLPASS)
  145. unt_g           equ     0.7                 ; gains (g)    REVERBERATOR
  146. neg_g           equ     -unt_g              ;       (-g)
  147. one_m_g2        equ     (1-unt_g*unt_g)     ;   "   (1-g**2)
  148.  
  149.  
  150. cmb_g           equ     0.86            ; (OVERALL) COMB FILTER FEEDBACK GAIN 
  151.                                         ; controls reverb decay time: smaller
  152.                                         ; values give quicker decay, larger
  153.